//    Travel US - For users of travel.usairways.com
//    intended for US Airways employees and their dependents
//    This app will help you track your flights and display
//    Availability, flight status and other non-rev info
//    Copyright (C) 2014  Renats Stozkovs
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.

package com.bc004346.travelus.model.domain;

import android.support.annotation.NonNull;

import java.io.Serializable;

/**
 * Created by Renats on 1/20/14.
 * Passenger class
 */
public class Passenger implements Comparable<Passenger>, Serializable {

    //<editor-fold desc="Members">

    private static final Long serialVersionUID = 4436222416000000003L;
    private String mName;
    private String mRelationship;
    private String mTicketNumber;
    private String mId;
    private String mLogin;
    private Boolean mSelected = false;
    private String mPhone;
    private String mEmail;
    private String mSeat;
    private String mFlightLeg;

    //</editor-fold>
    //<editor-fold desc="Constructors">

    public Passenger(String name, String relationship, String ticket) {
        setName(name);
        setRelationship(relationship);
        setTicketNumber(ticket);
    }

    public Passenger(String name, String id, String login, String phone, String email) {
        setName(name);
        setId(id);
        setLogin(login);
        setPhone(phone);
        setEmail(email);
    }

    public Passenger(String name, String seat) {
        setName(name);
        setSeat(seat);
    }

    //</editor-fold>
    //<editor-fold desc="Properties">

    public String getName() {
        return mName;
    }

    void setName(String name) {
        mName = name;
    }

    public String getRelationship() {
        return mRelationship;
    }

    void setRelationship(String relationship) {
        mRelationship = relationship;
    }

    public String getTicketNumber() {
        return mTicketNumber;
    }

    void setTicketNumber(String ticketNumber) {
        this.mTicketNumber = ticketNumber;
    }

    public String getId() {
        return mId;
    }

    void setId(String mId) {
        this.mId = mId;
    }

    public String getLogin() {
        return mLogin;
    }

    void setLogin(String mLogin) {
        this.mLogin = mLogin;
    }

    public Boolean isSelected() {
        return mSelected;
    }

    public void setSelected(Boolean mSelected) {
        this.mSelected = mSelected;
    }

    public String getPhone() {
        return mPhone;
    }

    public void setPhone(String mPhone) {
        this.mPhone = mPhone;
    }

    public String getEmail() {
        return mEmail;
    }

    public void setEmail(String mEmail) {
        this.mEmail = mEmail;
    }

    public String getSeat() {
        return mSeat;
    }

    public void setSeat(String mSeat) {
        this.mSeat = mSeat;
    }

    public String getFlightLeg() {
        return mFlightLeg;
    }

    public void setFlightLeg(String mFlightLeg) {
        this.mFlightLeg = mFlightLeg;
    }
    //</editor-fold>
    //<editor-fold desc="Overrides">

    @Override
    public int compareTo(@NonNull Passenger another) {
        if(this.getName() == null || this.getRelationship() == null || this.getTicketNumber() == null)
            return -1;

        if(another.getName() == null || another.getRelationship() == null || another.getTicketNumber() == null)
            return 1;

        if (this.getName().equals(another.getName())
                && this.getRelationship().equals(another.getRelationship())
                && this.getTicketNumber().equals(another.getTicketNumber()))
            return 0;

        return this.getName().compareTo(another.getName());
    }

    @Override
    public String toString() {
        return getName();
    }


    //</editor-fold>
}
